 const _ = require('util')

 /**
  * 对象排序转字符串
  */
 exports.raw = (args) => {
     let newArgs = {}
     let str = ''
     let keys = Object.keys(args)
     keys = keys.sort()
     for(let i = 0; i< keys.length; i++){
         newArgs[keys[i]] = args[keys[i]]
     }
     for(let k in newArgs) {
         str+='&'+k+'='+newArgs[k]
     }
     str = str.substr(1).replace(/\s/g,'')
     return str

 }

 /**
  * 数组去重
  */
 exports.removeDup = (arr) => {
     var result = [];
     var obj = {};
     for(var i = 0; i < arr.length; i++){
         if(!obj[arr[i]]){
             result.push(arr[i]);
             obj[arr[i]] = 1;
         }
     }
     return result;
 }